# open tomcat 6;
#
# docker build -t sys_tomcat:6_jdk6


FROM sys_java:jdk6

#---------------tomcat--------------------------
RUN mkdir /data/server/tomcat
#RUN wget -P /data/server/tomcat http://f.open.com.cn/S/shell/tomcat/apache-tomcat-8.0.32.tar.gz; tar -zxvf /data/server/tomcat/apache-tomcat-8.0.32.tar.gz -C /data/server/tomcat/; rm -f /data/server/tomcat/apache-tomcat-8.0.32.tar.gz
RUN wget -P /data/server/tomcat https://www.apache.org/dist/tomcat/tomcat-6/v6.0.45/bin/apache-tomcat-6.0.45.tar.gz; tar -zxvf /data/server/tomcat/apache-tomcat-6.0.45.tar.gz -C /data/server/tomcat/; rm -f /data/server/tomcat/apache-tomcat-6.0.45.tar.gz
RUN ln -s /data/server/tomcat/apache-tomcat-6.0.45 /data/server/tomcat/default


ENV CATALINA_HOME=/data/server/tomcat/default
RUN  chmod 777 /data/server/tomcat/default/bin/*.sh
RUN echo "CATALINA_HOME=/data/server/tomcat/default" >> /etc/profile

WORKDIR /data/server/tomcat/default
EXPOSE 80 5566


RUN sed -i "84i CATALINA_OPTS=\"-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5566\""  /data/server/tomcat/default/bin/catalina.sh


COPY ./server.xml /data/server/tomcat/default/conf/

#CMD ["/data/server/tomcat/default/bin/catalina.sh","run"]
ENTRYPOINT /data/server/tomcat/default/bin/catalina.sh start && /usr/sbin/sshd -D